package net.tmaize.lockview.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.Window;

import net.tmaize.lockview.R;
import net.tmaize.lockview.listrner.InputFinshListrner;
import net.tmaize.lockview.view.LockView;

public class LockViewDialog {

    private Dialog dialog;
    private Window window;
    private LockView lockView;

    public LockViewDialog(Context context, boolean cancelable) {
        dialog = new Dialog(context);
        window = dialog.getWindow();
        dialog.setCancelable(cancelable);
        dialog.setTitle("请输入密码");
        dialog.setContentView(R.layout.lock_view_dialog);
        lockView = (LockView) window.findViewById(R.id.lockview_dialog);
    }

    public void open(InputFinshListrner inputFinshListrner){
        lockView.setInputFinshListrner(inputFinshListrner);
        dialog.show();
    }

    public void close(){
        dialog.dismiss();
    }

    public String getInput(){
        return lockView.getInput();
    }
}
